<template>
  <ant-modal modalWidth="850" modalHeight="700" :visible="open" :modal-title="formTitle" :adjust-size="true" @cancel="cancel">
    <a-form-model ref="form" :model="form" :rules="rules" slot="content" layout="vertical">
      <a-row :gutter="32">
        <a-col :span="8" v-if="chooseUserDisabled">
          <a-form-model-item label="用户" prop="userId">
            <select-user v-model="form.userId" select-model="single" placeholder="请选择用户" />
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="版块" prop="sectionId">
            <select-section v-model="form.sectionId" placeholder="请选择版块" status="2" />
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="帖子类型" prop="type">
            <a-select
              placeholder="请选择类型"
              v-model="form.type"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear
            >
              <a-select-option v-for="(d, index) in typeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="4">
          <a-form-model-item label="联系人" prop="contact">
            <a-input v-model="form.contact" placeholder="请输入联系人" />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="联系电话" prop="phone">
            <a-input v-model="form.phone" placeholder="请输入联系电话" />
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="地址" prop="address">
            <a-input v-model="form.address" placeholder="请输入地址" />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="是否匿名" prop="anonymity">
            <a-radio-group v-model="form.anonymity" :defaultValue="form.status">
              <a-radio v-for="(dict, index) in anonymityOptions" :key="index" :value="dict.dictValue">
                {{ dict.dictLabel }}
              </a-radio>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="帖子标题" prop="title">
            <a-input v-model="form.title" placeholder="请输入帖子标题" />
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="帖子内容" prop="content" class="addModel">
            <editor ref="editor" v-model="form.content"></editor>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="帖子封面" prop="image">
            <image-upload v-model="form.image" isMultiple :number="1" />
          </a-form-model-item>
        </a-col>
        <!-- <a-col :span="12">
          <a-form-model-item label="帖子发布时间" prop="publishTime">
            <a-date-picker v-model="form.publishTime" :disabledDate="disabledDatePublish" :disabledTime="disabledTimePublish" :valueFormat="dateFormat" :show-today="true" show-time placeholder="选择日期" style="width: 100%" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="帖子修改时间" prop="editTime">
            <a-date-picker v-model="form.editTime" :disabledDate="disabledDateEdit" :disabledTime="disabledTimeEdit" :valueFormat="dateFormat" :show-today="true" show-time placeholder="选择日期" style="width: 100%" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="帖子点赞数" prop="likeNumber">
            <a-input-number v-model="form.likeNumber" :min="0" style="width: 100%" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="帖子收藏数" prop="collectNumber">
            <a-input-number v-model="form.collectNumber" :min="0" style="width: 100%" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="帖子回复数" prop="replyNumber">
            <a-input-number v-model="form.replyNumber" :min="0" style="width: 100%" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="帖子浏览数" prop="viewNumber">
            <a-input-number v-model="form.viewNumber" :min="0" style="width: 100%" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="帖子举报数" prop="reportNumber">
            <a-input-number v-model="form.reportNumber" :min="0" style="width: 100%" />
          </a-form-model-item>
        </a-col> -->
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-button :disabled="disabled" @click="cancel"> 取消 </a-button>
      <a-button type="primary" :disabled="disabled" @click="submitForm(true)"> 保存 </a-button>
    </template>
  </ant-modal>
</template>
<script>
import PostAddForm from './PostForm'
export default {
  ...PostAddForm
}
</script>
<style lang="less">
.addModel {
  .vditor-toolbar--pin {
    top: auto !important;
  }
}
</style>
